package io.renren.modules.lanling.service.impl;

import cn.hutool.core.lang.Validator;
import io.renren.modules.lanling.entity.QuestionRecordEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.lanling.dao.SearchDao;
import io.renren.modules.lanling.entity.SearchEntity;
import io.renren.modules.lanling.service.SearchService;


@Service("searchService")
public class SearchServiceImpl extends ServiceImpl<SearchDao, SearchEntity> implements SearchService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        //自定义分页列表
        Query query = new Query(params);
        List<SearchEntity> list = this.baseMapper.queryList(query);
        Integer total = this.baseMapper.queryTotal(query);

        return new PageUtils(list, total, query.getLimit(), query.getCurrPage());
    }

    @Override
    public void deleteByUserId(long studentId) {
        this.baseMapper.deleteByUserId(studentId);
    }

}
